<template>
	<view class="content">
		<view class="pic">
			<img :src="obj.prizesImage" alt="">
		</view>
		<view class="tit"><text style="font-weight: bold;">中奖商品：</text>{{obj.prizesName}}</view>
		<view class="time"><text style="font-weight: bold;">中奖时间：</text>{{obj.createTime}}</view>
		<view class="time">
			<text style="font-weight: bold;">收件人姓名：</text>
			<u-input v-model="obj.claimMethodsName" :height="100" input-align="right" />
		</view>
		<view class="time">
			<text style="font-weight: bold;">收件人手机号：</text>
			<u-input v-model="obj.claimMethodsPhone" :height="100" input-align="right" />
		</view>
		<view class="time">
			<text style="font-weight: bold;">收件人地址：</text>
			<u-input v-model="obj.claimMethodsText" :height="100" input-align="right" />
		</view>
		<view class="submit-box">
			<u-button shape="circle" @click="submitMail">提交邮寄信息</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				prizeid: 0,
				obj: {},
				claimMethodsName: "",
				claimMethodsPhone: "",
				claimMethodsText: ""
			}
		},
		onLoad(options) {
			this.prizeid = options.prizeid;
			this.getdetial(options.prizeid)
		},
		methods: {
			getdetial() {
				this.$api.request({
					url: '/api/system/winning/' + this.prizeid
				}).then((res) => {
					this.obj = res.data;
				})
			},
			submitMail() {
				this.$api.request({
					url: '/api/system/winning/',
					method: 'PUT',
					data: {
						id: this.prizeid,
						claimMethodsName: this.obj.claimMethodsName,
						claimMethodsPhone: this.obj.claimMethodsPhone,
						claimMethodsText: this.obj.claimMethodsText
					}
				}).then((res) => {
					if (res.code == 200) {
						uni.showToast({
							title: '提交成功',
							icon: 'none'
						})
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		padding-top: 30rpx;
		background: url('https://pic3.zhimg.com/v2-5188eb36ca4e080f80de0a75669e7de8_r.jpg') no-repeat;

		.pic {
			width: 700rpx;
			height: 400rpx;
			margin: 0 auto;
			background-color: #fff;
			border-radius: 30rpx;
			overflow: hidden;

			img {
				width: 100%;
				height: 100%;
			}
		}

		.tit,
		.time {
			width: 700rpx;
			height: 100rpx;
			padding: 0 30rpx;
			background-color: #fff;
			margin: 20rpx auto;
			line-height: 100rpx;
			border-radius: 30rpx;
			font-size: 40rpx;
			display: flex;
			justify-content: space-between;
		}

		.submit-box {
			width: 700rpx;
			height: 100rpx;
			margin: 20rpx auto;
		}
	}
</style>